package com.example.pjy.mapper;

import com.example.pjy.pojo.Rules;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface RulesMapper {
    //新增
    @Insert("insert into rules (rulesId,year,academicScoreWeight,politicalScoreWeight,researchScoreWeight,socialScoreWeight,awardPeople)" +
            "values(#{rulesId},#{year},#{academicScoreWeight},#{politicalScoreWeight},#{researchScoreWeight},#{socialScoreWeight},#{awardPeople})")
    void add(Rules rules);



    //查询所有
    @Select("select * from rules")
    List<Rules> list();


    //根据年份查询
    @Select("select * from rules where year = #{year}")
    Rules findByYear(Integer year);




    //更新
    @Update("update rules set rulesId=#{rulesId},year=#{year},academicScoreWeight=#{academicScoreWeight},politicalScoreWeight=#{politicalScoreWeight},researchScoreWeight=#{researchScoreWeight},socialScoreWeight=#{socialScoreWeight},awardPeople=#{awardPeople} where rulesId=#{rulesId}")
    void updateru(Rules rules);




    //删除
    @Delete("delete from rules where rulesId=#{rulesId}")
    void delete(Integer id);
}
